//
import { ResponseStructure } from '@/typings/request';
import { request } from '@umijs/max';

import {
  ColdTemperatureType,
  GetFishTypeType,
  OutInStockTrendType,
  OutTotalTop5Type,
  PackingType,
  StockTotalType,
  StockTrendType,
} from './typing';

export enum ApiUrlTwo {
  STOCKTREND = '/back/bigData/stockTrend', // 2楼看板-库存数量趋势
  OUTSTOCKTREND = '/back/bigData/outStockTrend', // 2楼看板-出库数量趋势
  INSTOCKTREND = '/back/bigData/inStockTrend', // 2楼看板-入库数量趋势
  GETPACKINGMONITOR = '/back/bigData/getPackingMonitor', // 2楼看板-生产数据监控
  GETSTOCKTOTAL = '/back/bigData/getStockTotal', // 2楼看板-库存信息--
  GETFISHTYPEPROPORTIONOUT = '/back/bigData/getFishTypeProportionOut', // 2楼看板-累计出库类型占比-每年的鱼类出库占比
  OUTTOTALTOP5 = '/back/bigData/outTotalTop5', // 2楼看板-出库数量TOP5（根据客户统计）
  GETCOLDTEMPERATUREMONITOR = '/back/bigData/getColdTemperatureMonitor', // 2楼看板-冷库温度监控
}

// 2楼看板-库存数量趋势
export async function stockTrend(data: StockTrendType.Body) {
  return request<ResponseStructure<StockTrendType.Response[]>>(
    ApiUrlTwo.STOCKTREND,
    {
      method: 'POST',
      data,
    },
  );
}
// 2楼看板-出库数量趋势
export async function outStockTrend(data: OutInStockTrendType.Body) {
  return request<ResponseStructure<OutInStockTrendType.Response[]>>(
    ApiUrlTwo.OUTSTOCKTREND,
    {
      method: 'POST',
      data,
    },
  );
}
// 2楼看板-入库数量趋势
export async function inStockTrend(data: OutInStockTrendType.Body) {
  return request<ResponseStructure<OutInStockTrendType.Response[]>>(
    ApiUrlTwo.INSTOCKTREND,
    {
      method: 'POST',
      data,
    },
  );
}
// 2楼看板-生产数据监控
export async function getPackingMonitor(data: PackingType.Body) {
  return request<ResponseStructure<PackingType.Response[]>>(
    ApiUrlTwo.GETPACKINGMONITOR,
    {
      method: 'POST',
      data,
    },
  );
}
// 2楼看板-累计出库占比
export async function getFishTypeProportionOut(data: GetFishTypeType.Body) {
  return request<ResponseStructure<GetFishTypeType.Response[]>>(
    ApiUrlTwo.GETFISHTYPEPROPORTIONOUT,
    {
      method: 'POST',
      data,
    },
  );
}
// 2楼看板-出库数量top5
export async function outTotalTop5(data: OutTotalTop5Type.Body) {
  return request<ResponseStructure<OutTotalTop5Type.Response[]>>(
    ApiUrlTwo.OUTTOTALTOP5,
    {
      method: 'POST',
      data,
    },
  );
}
// 2楼看板-冷库温度监控
export async function getColdTemperatureMonitor(
  data: ColdTemperatureType.Body,
) {
  return request<ResponseStructure<ColdTemperatureType.Response[]>>(
    ApiUrlTwo.GETCOLDTEMPERATUREMONITOR,
    {
      method: 'POST',
      data,
    },
  );
}
// 2楼看板-库存信息
export async function getStockTotal(data: StockTotalType.Body) {
  return request<ResponseStructure<StockTotalType.Response[]>>(
    ApiUrlTwo.GETSTOCKTOTAL,
    {
      method: 'POST',
      data,
    },
  );
}
